$(function () {
    /*初始化echarts表格的js文件*/
    var provinceName = "";
    var urlPrefix = "";
    var url  ="";
    var areaName = "";

    echart_1();

    echart_3();
    echart_4();

    echart_map();
    echart_5();


    //echart_1云南省火险指数
    function echart_1() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_1'));
        /*
    最近本人发现了配置更简单，更容易理解，更容易修改，bug更少的写法

    所以更新了原图表，这里分享给大家

    不知道用以前写法的小伙伴有没有发现

    1.项目中如果数据为0的话，hover的时候用以前的写法文字会将圆点盖住...

    2.鼠标放上的时候，x轴Pointer文字可能会有些轻微的向上或向下的移动...

    3.文字下划线和文字见的距离过小，有的时候不是很符合需求...

    以下旧写法我都注释了哈，现在生效的是新写法，新写法我也解释说明了哦

*/


        /*

            这个注释建议看完代码再看哦

            1.如果axisLabel和axisPointer的margin相同，则padding[0]必须等于0

            2.实现效果axisLabel和AxisPointer的字体大小必须相同

            3.此配置实现效果axisLabel和axisPointer的margin必须相同

            其他配置同样可以实现效果，如lineHeight等

            这是我整理、删除多余相同配置项后总结出的，使用方便，便于封装复用

            适用于大多数图表的配置

            更复杂的样式还是要参考配置文档的哦😘😘😘

        */
        const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF']
        option = {
            backgroundColor: '#fff',
            title: {
                text: '全国6月销售统计',
                textStyle: {
                    fontSize: 12,
                    fontWeight: 400
                },
                left: 'center',
                top: '5%'
            },
            legend: {
                icon: 'circle',
                top: '5%',
                right: '5%',
                itemWidth: 6,
                itemGap: 20,
                textStyle: {
                    color: '#556677'
                }
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    label: {
                        show: true,
                        backgroundColor: '#fff',
                        color: '#556677',
                        borderColor: 'rgba(0,0,0,0)',
                        shadowColor: 'rgba(0,0,0,0)',
                        shadowOffsetY: 0
                    },
                    lineStyle: {
                        width: 0
                    }
                },
                backgroundColor: '#fff',
                textStyle: {
                    color: '#5c6c7c'
                },
                padding: [10, 10],
                extraCssText: 'box-shadow: 1px 0 2px 0 rgba(163,163,163,0.5)'
            },
            grid: {
                top: '15%'
            },
            xAxis: [{
                type: 'category',
                data: ['北京', '上海', '广州', '深圳', '香港', '澳门', '台湾'],
                axisLine: {
                    lineStyle: {
                        color: '#DCE2E8'
                    }
                },
                axisTick: {
                    show: false
                },
                axisLabel: {
                    interval: 0,
                    textStyle: {
                        color: '#556677'
                    },
                    // 默认x轴字体大小
                    fontSize: 12,
                    // margin:文字到x轴的距离
                    margin: 15
                },
                axisPointer: {
                    label: {
                        // padding: [11, 5, 7],
                        padding: [0, 0, 10, 0],
                        /*
            除了padding[0]建议必须是0之外，其他三项可随意设置

            和CSSpadding相同，[上，右，下，左]

            如果需要下边线超出文字，设左右padding即可，注：左右padding最好相同

            padding[2]的10:

            10 = 文字距下边线的距离 + 下边线的宽度

            如：UI图中文字距下边线距离为7 下边线宽度为2

            则padding: [0, 0, 9, 0]

                        */
                        // 这里的margin和axisLabel的margin要一致!
                        margin: 15,
                        // 移入时的字体大小
                        fontSize: 12,
                        backgroundColor: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [{
                                offset: 0,
                                color: '#fff' // 0% 处的颜色
                            }, {
                                // offset: 0.9,
                                offset: 0.86,
                                /*
        0.86 = （文字 + 文字距下边线的距离）/（文字 + 文字距下边线的距离 + 下边线的宽度）

                                */
                                color: '#fff' // 0% 处的颜色
                            }, {
                                offset: 0.86,
                                color: '#33c0cd' // 0% 处的颜色
                            }, {
                                offset: 1,
                                color: '#33c0cd' // 100% 处的颜色
                            }],
                            global: false // 缺省为 false
                        }
                    }
                },
                boundaryGap: false
            }],
            yAxis: [{
                type: 'value',
                axisTick: {
                    show: false
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: '#DCE2E8'
                    }
                },
                axisLabel: {
                    textStyle: {
                        color: '#556677'
                    }
                },
                splitLine: {
                    show: false
                }
            }, {
                type: 'value',
                position: 'right',
                axisTick: {
                    show: false
                },
                axisLabel: {
                    textStyle: {
                        color: '#556677'
                    },
                    formatter: '{value}'
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: '#DCE2E8'
                    }
                },
                splitLine: {
                    show: false
                }
            }],
            series: [{
                name: 'Adidas',
                type: 'line',
                data: [10, 10, 30, 12, 15, 3, 7],
                symbolSize: 1,
                symbol: 'circle',
                smooth: true,
                yAxisIndex: 0,
                showSymbol: false,
                lineStyle: {
                    width: 5,
                    color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
                        offset: 0,
                        color: '#9effff'
                    },
                        {
                            offset: 1,
                            color: '#9E87FF'
                        }
                    ]),
                    shadowColor: 'rgba(158,135,255, 0.3)',
                    shadowBlur: 10,
                    shadowOffsetY: 20
                },
                itemStyle: {
                    normal: {
                        color: colorList[0],
                        borderColor: colorList[0]
                    }
                }
            }, {
                name: 'Nike',
                type: 'line',
                data: [5, 12, 11, 14, 25, 16, 10],
                symbolSize: 1,
                symbol: 'circle',
                smooth: true,
                yAxisIndex: 0,
                showSymbol: false,
                lineStyle: {
                    width: 5,
                    color: new echarts.graphic.LinearGradient(1, 1, 0, 0, [{
                        offset: 0,
                        color: '#73DD39'
                    },
                        {
                            offset: 1,
                            color: '#73DDFF'
                        }
                    ]),
                    shadowColor: 'rgba(115,221,255, 0.3)',
                    shadowBlur: 10,
                    shadowOffsetY: 20
                },
                itemStyle: {
                    normal: {
                        color: colorList[1],
                        borderColor: colorList[1]
                    }
                }
            },
                {
                    name: '老北京布鞋',
                    type: 'line',
                    data: [150, 120, 170, 140, 500, 160, 110],
                    symbolSize: 1,
                    yAxisIndex: 1,
                    symbol: 'circle',
                    smooth: true,
                    showSymbol: false,
                    lineStyle: {
                        width: 5,
                        color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{
                            offset: 0,
                            color: '#fe9a'
                        },
                            {
                                offset: 1,
                                color: '#fe9a8b'
                            }
                        ]),
                        shadowColor: 'rgba(254,154,139, 0.3)',
                        shadowBlur: 10,
                        shadowOffsetY: 20
                    },
                    itemStyle: {
                        normal: {
                            color: colorList[2],
                            borderColor: colorList[2]
                        }
                    }
                }
            ]
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });

        //点击查看详情，跳转到子页面
        myChart.on('click', function () {
            window.location.href = 'regionalDataDisplay_1.html';
        });
    }


    // echart_map中国地图
    function echart_map() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_map'));

        var mapName = 'china'

        /*获取地图数据*/
        myChart.showLoading();
        var mapFeatures = echarts.getMap(mapName).geoJson.features;
        myChart.hideLoading();


        var dataRange =  {
            x: '-1000 px', //图例横轴位置
                y: '-1000 px', //图例纵轴位置
                splitList: [
                { start: 1, end: 1, label: '北京', color: '#cfc5de' },
                { start: 2, end: 2, label: '天津', color: '#f1ebd1' },
                { start: 3, end: 3, label: '上海', color: '#feffdb' },
                { start: 4, end: 4, label: '重庆', color: '#e0cee4' },
                { start: 5, end: 5, label: '河北', color: '#fde8cd' },
                { start: 6, end: 6, label: '河南', color: '#e4f1d7' },
                { start: 7, end: 7, label: '云南', color: '#fffed7' },
                { start: 8, end: 8, label: '辽宁', color: '#e4f1d7' },
                { start: 9, end: 9, label: '黑龙江', color: '#e4f1d7' },
                { start: 10, end: 10, label: '湖南', color: '#fffed7' },
                { start: 11, end: 11, label: '安徽', color: '#fffed8' },
                { start: 12, end: 12, label: '山东', color: '#dccee7' },
                { start: 13, end: 13, label: '新疆', color: '#fffed7' },
                { start: 14, end: 14, label: '江苏', color: '#fce8cd' },
                { start: 15, end: 15, label: '浙江', color: '#ddceeb' },
                { start: 16, end: 16, label: '江西', color: '#e4f1d3' },
                { start: 17, end: 17, label: '湖北', color: '#fde8cd' },
                { start: 18, end: 18, label: '广西', color: '#fde8cd' },
                { start: 19, end: 19, label: '甘肃', color: '#fde8cd' },
                { start: 20, end: 20, label: '山西', color: '#fffdd6' },
                { start: 21, end: 21, label: '内蒙古', color: '#ddcfe6' },
                { start: 22, end: 22, label: '陕西', color: '#fad8e9' },
                { start: 23, end: 23, label: '吉林', color: '#fce8cd' },
                { start: 24, end: 24, label: '福建', color: '#fad8e8' },
                { start: 25, end: 25, label: '贵州', color: '#fad8e8' },
                { start: 26, end: 26, label: '广东', color: '#ddcfe8' },
                { start: 27, end: 27, label: '青海', color: '#fad8e9' },
                { start: 28, end: 28, label: '西藏', color: '#ddcfe6' },
                { start: 29, end: 29, label: '四川', color: '#e4f1d5' },
                { start: 30, end: 30, label: '宁夏', color: '#fefcd5' },
                { start: 31, end: 31, label: '海南', color: '#fad8e9' },
                { start: 32, end: 32, label: '台湾', color: '#fce8cd' },
                { start: 33, end: 33, label: '香港', color: '#dc9bbb' },
                { start: 34, end: 34, label: '澳门', color: '#e0f7cc' }
            ]
        }
        var series = [{
            type: 'map',
            mapType: 'china',
            label: {
                normal: {
                    show: true, //显示省份标签
                    textStyle: {
                        color: "white"
                    } //省份标签字体颜色
                },
                emphasis: { //对应的鼠标悬浮效果
                    show: true,
                    textStyle: {
                        color: "#000000"
                    }
                }
            },
            aspectScale: 0.75,
            zoom: 1.2,
            //缩放属性
            roam: true,
            itemStyle: {
                normal: {
                    borderWidth: .5, //区域边框宽度
                    borderColor: '#009fe8', //区域边框颜色
                    areaColor: "#ffefd5", //区域颜色
                },
                emphasis: {
                    borderWidth: 3,
                    borderColor: '#000000',
                    areaColor: "red",
                }
            },
            data:[
                {name: '北京',selected: false,value: 0},
                {name: '天津',selected: false,value: 0},
                {name: '上海',selected: false,value: 0},
                {name: '重庆',selected: false,value: 0},
                {name: '河北',selected: false,value: 0},
                {name: '河南',selected: false,value: 0},
                {name: '云南',selected: false,value: 0},
                {name: '辽宁',selected: false,value: 0},
                {name: '黑龙江',selected: false,value: 0},
                {name: '湖南',selected: false,value: 0},
                {name: '安徽',selected: false,value: 0},
                {name: '山东',selected: false,value: 0},
                {name: '新疆',selected: false,value: 0},
                {name: '江苏',selected: false,value: 0},
                {name: '浙江',selected: false,value: 0},
                {name: '江西',selected: false,value: 0},
                {name: '湖北',selected: false,value: 0},
                {name: '广西',selected: false,value: 0},
                {name: '甘肃',selected: false,value: 0},
                {name: '山西',selected: false,value: 0},
                {name: '内蒙古',selected: false,value: 0},
                {name: '陕西',selected: false,value: 0},
                {name: '吉林',selected: false,value: 0},
                {name: '福建',selected: false,value: 0},
                {name: '贵州',selected: false,value: 0},
                {name: '广东',selected: false,value: 0},
                {name: '青海',selected: false,value: 0},
                {name: '西藏',selected: false,value: 0},
                {name: '四川',selected: false,value: 0},
                {name: '宁夏',selected: false,value: 0},
                {name: '海南',selected: false,value: 0},
                {name: '台湾',selected: false,value: 0},
                {name: '香港',selected: false,value: 0},
                {name: '澳门',selected: false,value: 0}
            ] //各省地图颜色数据依赖value
        }];


        var option = {
            series: series,
            dataRange: dataRange
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        window.addEventListener("resize", function () {
            myChart.resize();
        });


        //获取点击地图时省份的名称
        myChart.on('click', function (params) {

            // params.name省份名称
            provinceName = params.name;
            // provinceName = dealSuffix(provinceName);
            console.log(provinceName);

            if(provinceName==="陕西"){
                $(".provinceName").val(provinceName+"1");
            }else{
                $(".provinceName").val(provinceName);
            }
            echart_2();
        });

    }


    //地区地图（省份/城市）
    function echart_2() {
        var myChart = echarts.init(document.getElementById('chart_2'));
        //将获取到的汉字转化为全拼音小写
        getProvinceJSONUrl();
        //将详细地图的标题改为provinceName
        $(".province").html(provinceName)

        //绘制地图
        drawMapByUrl(urlPrefix+url, provinceName, myChart);

        //点击地图时触发的事件
        myChart.on('click', function (param) {
            //显示具体地区地图并将温湿度图标题改为对应的城市
            areaName = param.name;
            $(".cityName").html(areaName);
            //将该区域重新绘图绘制成所点击地区的详细地图
            showCity();
        });

    }


    function showCity() {
        var myChart = echarts.init(document.getElementById('chart_2'));
        //获取城市json数据的url
        getCityJSONUrl();
        //重新在div中绘制地图
        drawMapByUrl(urlPrefix+url, areaName, myChart);
    }


    //echart_3湿度变化表
    function echart_3() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_3'));
        myChart.clear();
        option = {
            title: {
                text: ''
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data:['呈贡区','五华区','盘龙区','官渡区','西山区','东川区', '晋宁区'],
                textStyle:{
                    color: '#fff'
                },
                top: '8%'
            },
            grid: {
                top: '40%',
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['00:00','01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00'],
                splitLine: {
                    show: true
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            },
            yAxis: {
                name: 'RH',
                type: 'value',
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            },
            series: [
                {
                    name:'呈贡区',
                    type:'line',
                    data:[39.88, 33.63, 41.14, 33.01, 37.47,15.22,5.28,4.72,14.77, 15.17, 13.17]
                },
                {
                    name:'五华区',
                    type:'line',
                    data:[34.76, 33.76, 32.76, 31.82, 39.87,39.88, 33.63, 41.14, 33.01, 37.47]
                },
                {
                    name:'盘龙区',
                    type:'line',
                    data:[14.77, 15.17, 13.17, 14.56, 15.84,39.56,31.48,32.59,5.79,3.62, 12.60]
                },
                {
                    name:'官渡区',
                    type:'line',
                    data:[6.17,7.26,15.22,5.28,4.72,14.77, 15.17, 13.17, 14.56, 15.84]
                },
                {
                    name:'西山区',
                    type:'line',
                    data:[30.47, 37.89, 39.56,31.48,32.59,5.79,3.62, 12.60, 30.54, 36.77]
                },
                {
                    name:'东川区',
                    type:'line',
                    data:[9.60, 2.54, 6.77,5.79,3.62, 12.60, 30.54, 36.77,35.79,13.62]
                },{
                    name:'晋宁区',
                    type:'line',
                    data:[12.60, 30.54, 36.77,35.79,13.62,9.60, 2.54, 6.77,5.79,3.62, 12.60]
                }
            ]
        };
        myChart.setOption(option);
    }


    //云南温度变化表
    function echart_4() {
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('chart_9'));
        myChart.clear();
        option = {
            title: {
                text: ''
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data:['呈贡区','五华区','盘龙区','官渡区','西山区','东川区', '晋宁区'],
                textStyle:{
                    color: '#fff'
                },
                top: '8%'
            },
            grid: {
                top: '40%',
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            color: ['#FF4949','#FFA74D','#FFEA51','#4BF0FF','#44AFF0','#4E82FF','#584BFF','#BE4DFF','#F845F1'],
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['00:00','01:00','02:00','03:00','04:00','05:00','06:00','07:00','08:00','09:00','10:00','11:00','12:00','13:00','14:00','15:00','16:00','17:00','18:00','19:00','20:00','21:00','22:00','23:00'],
                splitLine: {
                    show: true
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            },
            yAxis: {
                name: 'RH',
                type: 'value',
                splitLine: {
                    show: false
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff'
                    }
                }
            },
            series: [
                {
                    name:'呈贡区',
                    type:'line',
                    data:[39.88, 33.63, 41.14, 33.01, 37.47,15.22,5.28,4.72,14.77, 15.17, 13.17]
                },
                {
                    name:'五华区',
                    type:'line',
                    data:[34.76, 33.76, 32.76, 31.82, 39.87,39.88, 33.63, 41.14, 33.01, 37.47]
                },
                {
                    name:'盘龙区',
                    type:'line',
                    data:[14.77, 15.17, 13.17, 14.56, 15.84,39.56,31.48,32.59,5.79,3.62, 12.60]
                },
                {
                    name:'官渡区',
                    type:'line',
                    data:[6.17,7.26,15.22,5.28,4.72,14.77, 15.17, 13.17, 14.56, 15.84]
                },
                {
                    name:'西山区',
                    type:'line',
                    data:[30.47, 37.89, 39.56,31.48,32.59,5.79,3.62, 12.60, 30.54, 36.77]
                },
                {
                    name:'东川区',
                    type:'line',
                    data:[9.60, 2.54, 6.77,5.79,3.62, 12.60, 30.54, 36.77,35.79,13.62]
                },{
                    name:'晋宁区',
                    type:'line',
                    data:[12.60, 30.54, 36.77,35.79,13.62,9.60, 2.54, 6.77,5.79,3.62, 12.60]
                }
            ]
        };
        myChart.setOption(option);

    }


    //某市风速风向柱状图
    function echart_5() {
        var myChart = echarts.init(document.getElementById('model_5'));
        var option = {
            title:{
                show:true,
                text:'',
                top:'1%',
                left:'1%',
                textStyle:{
                    color:'#005580',
                    fontSize:24,
                },
            },
            backgroundColor: 'rgba(128, 128, 128, 0.1)',
            tooltip: {
                trigger: "axis",
                axisPointer: {
                    // 坐标轴指示器，坐标轴触发有效
                    type: "shadow" // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            grid: {
                top: '12%',
                left: '1%',
                right: '1%',
                bottom: '8%',
                containLabel: true,
            },
            legend: {
                itemGap: 20,
                right:'2%',
                top:'2%',
                data: ['什么','风速','风向' ],
            },
            xAxis: [{
                type: 'category',
                boundaryGap: true,
                axisLine: { //坐标轴轴线相关设置。数学上的x轴
                    show: false,
                    lineStyle: {
                        color: '#f9f9f9'
                    },
                },
                axisLabel: { //坐标轴刻度标签的相关设置
                    textStyle: {
                        color: '#005580',
                        margin: 15,
                    },
                },
                axisTick: {
                    show: false,
                },
                data: ['大连石化', '大连西太', '锦西石化', '辽河石化', '大港石化','广西石化','中燃油'],
            }],
            yAxis: [{
                name:'',
                type: 'value',
                min: 0,
                splitNumber: 7,
                splitLine: {
                    show: true,
                    lineStyle: {
                        color: '#e6e5e5'
                    }
                },
                axisLine: {
                    show: false,
                },
                axisLabel: {
                    margin: 20,
                    textStyle: {
                        color: '#005580',
                    },
                    formatter:function (value, index) {
                        return value.toFixed(1);
                    }
                },
                axisTick: {
                    show: false,
                },
            }],
            series: [{
                name: '什么',
                type: 'line',
                symbol: 'circle',
                symbolSize: 10,
                lineStyle: {
                    normal: {
                        color: "#000000", // 线条颜色
                    },
                    borderColor: '#000000'
                },
                itemStyle: {
                    normal: {
                        color: "#000000",
                    }
                },
                data: [7, 50, 13, 12, 11,50,200]
            },
                {
                    name: '风速',
                    type: 'bar',
                    barWidth: 30,
                    barGap:'0%',
                    color:'#79A1B5',
                    label: {
                        show: true,
                        position: 'insideTop',
                        textStyle: {
                            color: '#F6F8FA',
                        }
                    },
                    itemStyle: {
                        normal: {
                            barBorderRadius: 3,
                        }
                    },
                    data: [8, 45, 13, 10, 16,45,203]
                }, {
                    name: '风向',
                    type: 'bar',
                    barWidth: 30,
                    color:'#f',
                    label: {
                        show: true,
                        position: 'insideTop',
                        textStyle: {
                            color: '#ffffff',
                        }
                    },
                    itemStyle: {
                        normal: {
                            barBorderRadius:3,
                        }
                    },
                    data: [6, 60, 17, 24, 7,80,180]
                }]
        };

        myChart.setOption(option);
    }


    //通过json数据的url来绘制地图
    function drawMapByUrl(url, name, chart) {
        //清除画布
        chart.clear();

        $.get(url, result => {
            // 注册 echarts 地图
            echarts.registerMap(name, result);

            var series = [{
                type: 'map',
                mapType: name,
                label: {
                    normal: {
                        show: true, //显示省份标签
                        textStyle: {
                            color: "#ffffff"
                        } //省份标签字体颜色
                    },
                    emphasis: { //对应的鼠标悬浮效果
                        show: true,
                        textStyle: {
                            color: "#000000"
                        }
                    }
                },
                aspectScale: 0.75,
                zoom: 1.2,
                itemStyle: {
                    normal: {
                        borderWidth: .5, //区域边框宽度
                        borderColor: '#009fe8', //区域边框颜色
                        // areaColor: "#000050", //区域颜色
                        areaColor: 'rgba(128, 128, 128, 0.1)'
                    },
                    emphasis: {
                        borderWidth: 3,
                        borderColor: '#000000',
                        areaColor: "red",
                    }
                },
            }];


            var option = {
                tooltip: {
                    trigger: 'item',
                },
                title: {
                    // text: 'xx省/市地图',
                    x: "center",
                },
                roam: true,
                series: series
            };
            chart.setOption(option);
        });
    }


    //获取省份json数据的url
    function getProvinceJSONUrl(){
        var name = $(".provinceName").toPinyin().trim().toLowerCase().replaceAll(" ","");
        //处理多音字或者有问题的字符串
        if(name==='xicang') name = 'xizang';
        else if(name==='namenggu') name = 'neimenggu';
        else if(name==='zhongqing') name = 'chongqing';

        urlPrefix = "../../json/regionalDataDisplay/"
        url = name+".json";
    }


    //获取城市json数据的url
    function getCityJSONUrl() {
        var name = $(".cityName").html();
        urlPrefix = "../../json/regionalDataDisplay/city/";
        url = name+".json";
    }


    //处理省份字符串后缀
    function dealSuffix(name){
        name = name.replace("维吾尔自治区", "");
        name = name.replace("壮族自治区", "");
        name = name.replace("自治区", "");
        name = name.replace("省", "");
        return name;
    }

});
